package com.qhy.springcloud.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.qhy.springcloud.api.Dept;
import com.qhy.springcloud.myhandler.CustomerBlockHandler;
import dao.CommonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author qiuhongyu
 * @date 2020/12/3 18:16
 */
@RestController
public class RateLimitController {
    @GetMapping("/rateLimit/customerBlockHandler")
    @SentinelResource(value = "qhyCustomerBlockHandler",
            blockHandlerClass = CustomerBlockHandler.class, blockHandler = "handlerException2")
    public CommonResult customerBlockHandler() {
        return new CommonResult(200,
                "按客户自定义",
                new Dept(2020L, "qhy", "qhytest"));
    }

}
